if(WIN32)
    LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib/Release)
else()
    LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib)
endif()
add_executable(CybertronMaster "")

include_directories("${CYBERTRON_PATH_SOURCE}/CoreLibrary/include")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty/asio")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty/gtest/include")
include_directories("${CYBERTRON_PATH_SOURCE}/Protocol/Output/cpp")

IF (WIN32)
	add_definitions(-D_WIN32_WINNT=0x0501)
ENDIF()

add_definitions(-DNOMINMAX)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)

file(GLOB_RECURSE srcs *.h *.hh *i *.hpp *.c *.cc *.cpp)
target_sources(CybertronMaster PRIVATE ${srcs})
source_group(Source FILES ${srcs})

SetDefaultTargetProperties(CybertronMaster)
if (WIN32)
target_link_libraries(CybertronMaster advapi32
       iphlpapi
       psapi
       shell32
       user32
       userenv
       ws2_32
       crypt32    #for libcurl
       Wldap32    #for libcurl
       Normaliz   #for libcurl
	   pdh # for pdh_util/query.cpp
       ${CYBERTRON_PATH_ROOT}/3rdparty/libcurl/lib_win_x64/libcurl_a.lib)
else()
target_link_libraries(CybertronMaster pthread)
target_link_libraries(CybertronMaster rt)
endif()
message(${CMAKE_BINARY_DIR})

target_link_libraries(CybertronMaster CybertronCore)
target_link_libraries(CybertronMaster CybertronLogApi)
target_link_libraries(CybertronMaster protobuf)

IF (MSVC)
	SET_PROPERTY(TARGET CybertronMaster PROPERTY FOLDER "Commander")
ENDIF()
